﻿var userAgent = navigator.userAgent, 
				rMsie = /(msie\s|trident.*rv:)([\w.]+)/, 
				rFirefox = /(firefox)\/([\w.]+)/, 
				rOpera = /(opera).+version\/([\w.]+)/, 
				rChrome = /(chrome)\/([\w.]+)/, 
				rSafari = /version\/([\w.]+).*(safari)/;
				var browser;
				var version;
				var ua = userAgent.toLowerCase();
				function uaMatch(ua) {
					var match = rMsie.exec(ua);
					if (match != null) {
						return { browser : "IE", version : match[2] || "0" };
					}
					var match = rFirefox.exec(ua);
					if (match != null) {
						return { browser : match[1] || "", version : match[2] || "0" };
					}
					var match = rOpera.exec(ua);
					if (match != null) {
						return { browser : match[1] || "", version : match[2] || "0" };
					}
					var match = rChrome.exec(ua);
					if (match != null) {
						for (var key in navigator.plugins) {
							// np-mswmp.dll只在360浏览器下存在
							if (navigator.plugins[key].filename == 'internal-nacl-plugin') {
								return { browser : "360", version : match[2] || "0" };
							}
						}
						return { browser : match[1] || "", version : match[2] || "0" };
					}
					var match = rSafari.exec(ua);
					if (match != null) {
						return { browser : match[2] || "", version : match[1] || "0" };
					}
					if (match != null) {
						return { browser : "", version : "0" };
					}
				}
				var browserMatch = uaMatch(userAgent.toLowerCase());
				if (browserMatch.browser) {
					browser = browserMatch.browser;
					version = browserMatch.version;
				}

var str = '';

var copyright='金格科技iWebOffice2015智能文档中间件[演示版];V5.0S0xGAAEAAAAAAAAAEAAAAJEBAACgAQAALAAAAA6pYlMzV7TN91Xx798YyA3x0u7LWQ4ZDi5RPkXZ9Dd2JIkW3LKly7r83j4f7C5/1vwyZb+//c+FThV1Lu9DCSy41ElQ06BzFwZcLrBMOlVwKJtWamoXOrRERgDuq83foZI1Isj8SxD4uU213MvZckNJKycrI5BngcM7JHdRR4M2ubyYvrqzMzRZyY8RQ/OFMf9tSGQieZvRWvShQOV0UlhibtSwLB6/Fnun08TZIDcUrsiiE2WbN9qBvQQXMDaOau2+ZFGhgdMqvZxFXDSUumWgNoLcA1t9NQ7tkAwbZKpuIC0OP44ZR6ZeaetLdUx9scPmVGxEevaQo845aCZo9PSf433NKr9hIAGfTj30SV+dRS4x4lpRO5p9/FkgGyvmdaQi+v/j8eH+brVThKZOrA4LEpyBCHo/5NhAmi5gPGeoPIy5Iu1ZeqJRBSR1EATavePwpQYgXG3gVVE7R1MqcM9lYzw4gxhStZI/hKgjgw7Jqj9CVp4GbMs+aY5V6aBJ90gwfku8RLcPFYW6BdMibLCKMDMkl4fwFE8azlTWPb8DcXubJ/obg6ffxbXUW59lJQ==';



if ((window.ActiveXObject!=undefined) || (window.ActiveXObject!=null) ||"ActiveXObject" in window)
{
	str += '<object id="iWebPDF2018" ';
	str += ' width="100%"';
	str += ' height="100%"';
	/*
	if(window.navigator.platform == "Win32")
		str += ' CLASSID="CLSID:D89F482C-5045-4DB5-8C53-D2C9EE71D025"  codebase="iWebOffice2015.cab#version=12,5,0,648"';
	if (window.navigator.platform == "Win64")
		str += ' CLASSID="CLSID:D89F482C-5045-4DB5-8C53-D2C9EE71D024"  codebase="iWebOffice2015.cab#version=12,5,0,648"';
	str += '>';
	*/
	if(window.navigator.platform == "Win32")
		str += ' CLASSID="CLSID:7017318C-BC50-4DAF-9E4A-10AC8364C315"';
	if (window.navigator.platform == "Win64")
		str += ' CLASSID="CLSID:7017318C-BC50-4DAF-9E4A-10AC8364C364"';
	str += ' codebase="iWebPDF2018.cab"';
	str += '>';
	
}
else if (browser == "chrome") 
{
	str += '<object id="iWebPDF2018" ';
	str += ' width="100%"';
	str += ' height="100%"';
	str += ' clsid="CLSID:7017318C-BC50-4DAF-9E4A-10AC8364C315"';         
	str += ' type="application/kg-plugin"';
	str += ' OnAddinEventInvoke="OnAddinEventInvoke"';
	str += ' OnCommand="OnCommand"';
	str += ' OnOLECommand="OnOLECommand"';	
	str += ' OnToolsClick="OnToolsClick"';			//绑定自定义按钮触发事件
	str += ' Copyright="' + copyright + '"';
	str += '>';
}else if (browser == "360") 
{
	str += '<object id="iWebPDF2018" ';
	str += ' width="100%"';
	str += ' height="100%"';
	str += ' clsid="CLSID:7017318C-BC50-4DAF-9E4A-10AC8364C315"';         
	str += ' type="application/kg-plugin"';
	str += ' OnAddinEventInvoke="OnAddinEventInvoke"';
	str += ' OnCommand="OnCommand"';
	str += ' OnOLECommand="OnOLECommand"';	
	str += ' OnToolsClick="OnToolsClick"';			//绑定自定义按钮触发事件
	str += ' Copyright="' + copyright + '"';
	str += '>';
}
else if (browser == "firefox") 
{
	str += '<object id="iWebPDF2015" ';
	str += ' width="100%"';
	str += ' height="100%"';
	str += ' clsid="CLSID:7017318C-BC50-4DAF-9E4A-10AC8364C315"';
	str += ' type="application/kg-activex"';
	str += ' OnCommand="OnCommand"';
	str += ' OnAddinEventInvoke="OnAddinEventInvoke"';
	str += ' OnOLECommand="OnOLECommand"';
	str += ' Copyright="' + copyright + '"';
	str += '>';
}
str += '</object>';
// document.write(str); 
//alert(str);
export default str;

